<html>
<head><meta charset="utf-8"><title>Emacs jump to defintion on external crates · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html">Emacs jump to defintion on external crates</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198343625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20jump%20to%20defintion%20on%20external%20crates/near/198343625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kaviraj Kanagaraj (he) (F2&#x27;19) <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html#198343625">(May 21 2020 at 16:33)</a>:</h4>
<p>Anyone facing issue of not able to jump to definition for external crates "sometimes?"</p>
<p>Sometimes  meaning</p>
<ol>
<li>Working case - You have some crate on cargo.toml (say serde) and you open that project in emacs (rust-analyzer via lsp hook). Now I can jump to definition of serde via M-.</li>
<li>Not working case - you add new crate via "cargo add &lt;xyz&gt;" now use it in your project that is already open. Now I cannot use go-to defintion. But if I do <code>lsp-workspace-restart</code>, I can go to definition of newly added crate (xyz)</li>
</ol>
<p>is anyone else facing similar issue? can we make it work without lsp-workspace-restart? NOTE: it works with Go + lsp-mode just fine, without any restart.</p>
<p>To me it looks like need to add some hook on every time you add crate via cargo!</p>
<p>Any help is appreciated! thanks :)</p>



<a name="198344296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20jump%20to%20defintion%20on%20external%20crates/near/198344296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html#198344296">(May 21 2020 at 16:39)</a>:</h4>
<p>Yes, that's normal :-)</p>



<a name="198344338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20jump%20to%20defintion%20on%20external%20crates/near/198344338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html#198344338">(May 21 2020 at 16:39)</a>:</h4>
<p>See <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3715">https://github.com/rust-analyzer/rust-analyzer/issues/3715</a> and the related issues</p>



<a name="198344369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20jump%20to%20defintion%20on%20external%20crates/near/198344369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html#198344369">(May 21 2020 at 16:39)</a>:</h4>
<p>You need to restart the server after changing the project structure.</p>



<a name="198345360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Emacs%20jump%20to%20defintion%20on%20external%20crates/near/198345360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kaviraj Kanagaraj (he) (F2&#x27;19) <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Emacs.20jump.20to.20defintion.20on.20external.20crates.html#198345360">(May 21 2020 at 16:47)</a>:</h4>
<p>ah. I see. thanks for pointing it out! <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>